using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.VisualBasic;

/// <summary>
/// Summary description for Utility
/// </summary>
public class Utility
{
	public Utility()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public static string NoContent = "<span style='font-size:9pt;font-family:Arial;'>No Content</span>";

    public static string ConvertToGB(string big5)
    {
        return Microsoft.VisualBasic.Strings.StrConv(big5, VbStrConv.SimplifiedChinese, 0);
    }

    public static string ConvertToBig5(string gb)
    {
        return Microsoft.VisualBasic.Strings.StrConv(gb, VbStrConv.TraditionalChinese, 0);
    }

    public static string GetDBValue(DataRow row, string columnname)
    {
        if (row.IsNull(columnname))
        {
            return "";
        }
        else
        {
            return row[columnname].ToString();
        }
    }

    public static string GetCulture(Page pagepass)
    {
        PageBase page = pagepass as PageBase;
        if (page != null)
        {
            if (page.pageCulture == "cn")
            {
                return "cn";
            }
            else
            {
                return "tw";
            }
        }
        else
        {
            return "tw";
        }
    }

    public static string ConvertToHtml(string strText)
    {
        if (String.IsNullOrEmpty(strText))
        {
            return Utility.NoContent;
        }
        else
        {
            return (strText.Replace("\n", "<br>"));
        }
    }
}
